//
//  MYProfileViewController.m
//  奇闻
//
//  Created by 似水灵修 on 14-11-20.
//  Copyright (c) 2014年 MingYueGuCheng. All rights reserved.
//

#import "MYProfileViewController.h"
#import "MYBaseSetting.h"
#import "MYProfileCell.h"
#import "MYSettingViewController.h"

@interface MYProfileViewController ()

@end

@implementation MYProfileViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"设置" style:UIBarButtonItemStyleBordered target:self action:@selector(setting)];
    [self setupGroup0];
    [self setupGroup1];
    [self setupGroup2];
    [self setupGroup3];
}
- (void)setupGroup0
{
    // 新的好友
    MYArrowItem *friend = [MYArrowItem itemWithImage:[UIImage imageNamed:@"new_friend"] title:@"新的好友"];
    MYGroupItem *group = [[MYGroupItem alloc] init];
    group.items = @[friend];
    [self.gorups addObject:group];
}
- (void)setupGroup1
{
    // 我的相册
    MYArrowItem *photo = [MYArrowItem itemWithImage:[UIImage imageNamed:@"album"] title:@"我的相册" subTitle:@"(12)"];
    // 我的收藏
    MYArrowItem *collect = [MYArrowItem itemWithImage:[UIImage imageNamed:@"collect"] title:@"我的收藏" subTitle:@"(0)"];
    MYArrowItem *like = [MYArrowItem itemWithImage:[UIImage imageNamed:@"like"] title:@"赞" subTitle:@"(1)"];
    MYGroupItem *group = [[MYGroupItem alloc] init];
    group.items = @[photo, collect, like];
    [self.gorups addObject:group];
}
- (void)setupGroup2
{
    // 奇闻支付
    MYArrowItem *pay = [MYArrowItem itemWithImage:[UIImage imageNamed:@"pay"] title:@"奇闻支付"];
    // 个性化
    MYArrowItem *vip = [MYArrowItem itemWithImage:[UIImage imageNamed:@"vip"] title:@"个性化" subTitle:@"奇闻来源,皮肤,封面图"];
    MYGroupItem *group = [[MYGroupItem alloc] init];
    group.items = @[pay, vip];
    [self.gorups addObject:group];
}
- (void)setupGroup3
{
    // 我的二维码
    MYArrowItem *card = [MYArrowItem itemWithImage:[UIImage imageNamed:@"card"] title:@"我的二维码"];
    // 草稿箱
    MYArrowItem *draft = [MYArrowItem itemWithImage:[UIImage imageNamed:@"draft"] title:@"草稿箱"];
    MYGroupItem *group = [[MYGroupItem alloc] init];
    group.items = @[card, draft];
    [self.gorups addObject:group];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MYProfileCell *cell = [MYProfileCell cellWithTableView:tableView];
    MYGroupItem *group = self.gorups[indexPath.section];
    MYSettingItem *item = group.items[indexPath.row];
    cell.item = item;
    return cell;
}
- (void)setting
{
    MYSettingViewController *settingVC = [[MYSettingViewController alloc] init];
    [self.navigationController pushViewController:settingVC animated:YES];
}

@end
